/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-07-17 17:50:43
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-07-18 09:20:16
 * @FilePath: \cxl-h5\src\store\load.store.ts
 */

import { reactive } from 'vue'

class LoadStore {
    _status = false // true 开始 false 未开始
    _finish = true // true 已完成 false 未完成
    arr: any[] = []
    timer: any
    start() {
        if (this._finish && !this._status) {
            this._status = true
            console.log('开始了')
        }

        if (this.timer) {
            console.log('开始了2', this.timer)
            clearTimeout(this.timer)
        }
    }
    finish() {
        this.timer = setTimeout(() => {
            this._finish = true
            this._status = false
            console.log('执行了', this.timer)
            clearTimeout(this.timer)
        }, 50)
    }
}
const loadStatus = reactive(new LoadStore())

export default loadStatus
